﻿var modifyCardButtons = function () {
    if ($(".selected").length) {
        if ($(".selected").find("td.block").text() == "True") {
            $("#unblockCard").removeClass("invisible");
            $("#blockCard").addClass("invisible");
        } else {
            $("#blockCard").removeClass("invisible");
            $("#unblockCard").addClass("invisible");
        }
    }
};

$(function () {
    $("#blockCard").click(function() {
        $("#cardForm").attr("action", "/Cards/Block").submit();
        return false;
    });

    $("#unblockCard").click(function() {
        $("#cardForm").attr("action", "/Cards/UnBlock").submit();
        return false;
    });
    
    modifyCardButtons();
});